package cn.gong.base.ui;

import android.app.Activity;
import android.util.SparseArray;

public class ActManager {
	private SparseArray<ActID> allAct;
	private int size = 0;
	public static int CURRENT_ACTID;

	private static ActManager instance = new ActManager();

	private ActManager() {
		allAct = new SparseArray<ActID>();
	}

	public static ActManager getInstance() {
		return instance;
	}

	public void clearSize() {
		size = 0;
	}

	public void addAct(ActID baseAct) {
		size++;
		baseAct.setActID(size);
		allAct.put(baseAct.getActID(), baseAct);
	}

	public void deleteAct(ActID activity) {
		// 防止actId重复。移除时size不自减
		allAct.remove(activity.getActID());
	}

	public int getSize() {
		return size;
	}

	public ActID getAct(int key) {
		return allAct.get(key);
	}

	public SparseArray<ActID> getAllAct() {
		return allAct;
	}

}
